<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>是星期几？</title>
    <script>
      //用户输入天数
      var num = parseInt(prompt("请输入您想知道多少天后是星期几", "1000"));
      // 当前星期数（多少天后包含当天，固需减1）后是星期几
      var dayOfWeek = (num + new Date().getDay() - 1) % 7;
      //星期几
      var day = "";
      switch (dayOfWeek) {
        case 1:
          day = "一";
          break;

        case 2:
          day = "二";
          break;

        case 3:
          day = "三";
          break;

        case 4:
          day = "四";
          break;

        case 5:
          day = "五";
          break;

        case 6:
          day = "六";
          break;

        default:
          day = "天";
          break;
      }
      alert("当前" + num + "天后是星期" + day);
    </script>
  </head>
  <body></body>
</html>
